package com.konne.nightmare.FastPublicOpinion.ui.information.activity;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import com.blankj.utilcode.util.ActivityUtils;
import com.blankj.utilcode.util.BarUtils;
import com.blankj.utilcode.util.FragmentUtils;
import com.konne.nightmare.FastPublicOpinion.R;
import com.konne.nightmare.FastPublicOpinion.base.BaseMvpActivity;
import com.konne.nightmare.FastPublicOpinion.mvp.presenter.GroupManagerPresenter;
import com.konne.nightmare.FastPublicOpinion.mvp.view.IGroupManagerView;
import com.konne.nightmare.FastPublicOpinion.utils.LoadProgressDialog;
import com.konne.nightmare.FastPublicOpinion.widget.QJActionBar;

import butterknife.BindView;

/**
 * Create by ws.
 * on Data:2022/1/25  Time:下午 6:55.
 * description: 分组管理页面 .
 */
public class GroupManagerActivity extends BaseMvpActivity<IGroupManagerView, GroupManagerPresenter> implements IGroupManagerView {
    @BindView(R.id.action_bar)
    QJActionBar actionBar;
    /**
     * TODO 其他参数另行配置，根据分类拿自己想要的数据
     * @param type 0:移动分组的学生，1：移动分组的组列表，2，分组下的学生列表,3,从移入当前组，4，从当前组移除 5,设置组长
     * */
    public static void start(int type){
        Intent intent=new Intent(ActivityUtils.getTopActivity(),GroupManagerActivity.class);
        intent.putExtra("type",type);
        ActivityUtils.startActivity(intent);
    }
    @Override
    protected GroupManagerPresenter createPresenter() {
        return new GroupManagerPresenter();
    }

    @Override
    public int getLayout() {
        return R.layout.activity_create_group;
    }

    @Override
    public void initView() {
        BarUtils.transparentStatusBar(this);
        BarUtils.setStatusBarLightMode(this,true);
        actionBar.setTitle("分组");
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        Intent intent=getIntent();
        int type=intent.getIntExtra("type",0);
        if(type==1){
            actionBar.setTitle("选择要移动的组");
        }else if(type==5){
            actionBar.setTitle("设定组长");
        }
        mPresenter.init(type);
    }


    @Override
    public void setFragment(Fragment fragment) {
        FragmentUtils.add(getSupportFragmentManager(),fragment,R.id.fl_content);
        FragmentUtils.show(fragment);
    }

    @Override
    public LoadProgressDialog getLoadDialog() {
        return dialog;
    }

    @Override
    public void cancelLoadDialog() {

    }
}
